package com.nbicc.service.impl;

import com.github.pagehelper.PageInfo;
import com.nbicc.mapper.RecordMapper;
import com.nbicc.pojo.Finan;
import com.nbicc.pojo.Record;
import com.nbicc.service.RecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @ClassName:
 * @Author: 仄言in
 * @Desctiption: (描述)
 * @Date: 2021/5/11 13:51
 * @Version 1.0 (版本)
 */
@Service
public class RecordServiceImpl implements RecordService {
    @Autowired
    private RecordMapper recordMapper;
    @Override
    @Transactional
    public PageInfo<Record> selectAll() {
        List<Record> records = recordMapper.selectList(null);
        PageInfo<Record> pageInfo = new PageInfo<>(records);
        return pageInfo;
    }

    @Override
    @Transactional
    public int deletById(Integer id) {
        return recordMapper.deleteById(id);
    }

    @Override
    @Transactional
    public int updateById(Record record) {
        return recordMapper.updateById(record);
    }

    @Override
    @Transactional
    public int addFinan(Record record) {
        return recordMapper.insert(record);
    }

    @Override
    @Transactional
    public PageInfo<Record> selectAllSB(String unitname) {
        List<Record> records = recordMapper.selectAllSB(unitname);
        PageInfo<Record> pageInfo = new PageInfo<>(records);
        return pageInfo;
    }

    @Override
    @Transactional
    public Record selectById(Integer id) {
        return recordMapper.selectById(id);
    }

    @Override
    @Transactional
    public Double totalRowRecord() {
        return recordMapper.totalRowRecord();
    }

    @Override
    @Transactional
    public int insertRecord(Record record) {
        return recordMapper.insertRecord(record);
    }

    @Override
    @Transactional
    public List<Record> selectAllExcel() {
        return recordMapper.selectList(null);
    }


}
